package com.bawei.module_home.home.model.repository


import com.bawei.lib_net.RetrofitFactory
import com.bawei.module_home.home.model.api.HomeApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn

class HomeRepository {
    val api: HomeApi
    init {
        api= RetrofitFactory.getRetrofitFactory().create(HomeApi::class.java)
    }
    /**
     * 获取视频类型信息
     */
    suspend fun getSimpleType() = flow {
        emit(api.getSimpleType())
    }.flowOn(Dispatchers.IO)
    suspend fun getVideo(channelId:String, page:Int, pageSize:Int) = flow {
        emit(api.getVideo(channelId, page, pageSize))
    }.flowOn(Dispatchers.IO)
}